import request from '@/utils/request'

//待分配- 驻点经理
export function receivedList(params) {
  return request({
    url: '/repair/workOrder/assignedList',
    method: 'get',
    params
  })
}

//待完成 - 驻点经理
export function todoList(params) {
  return request({
    url: '/repair/workOrder/todoList',
    method: 'get',
    params
  })
}

//待完成 - 工程师
export function myTodoList(params) {
  return request({
    url: '/repair/workOrder/myTodoList',
    method: 'get',
    params
  })
}


//已完成- 驻点经理
export function finishList(params) {
  return request({
    url: '/repair/workOrder/finishList',
    method: 'get',
    params
  })
}

//已完成- 工程师
export function myFinishList(params) {
  return request({
    url: '/repair/workOrder/myFinishList',
    method: 'get',
    params
  })
}

//获取工单列表
export function list(params) {
  return request({
    url: '/repair/workOrder/list',
    method: 'get',
    params
  })
}

// 获取工单详细信息
export function workOrderDetail(id) {
  return request({
    url: '/repair/workOrder/' + id,
    method: 'get',
  })
}

//开始工单
export function workOrderStart(workOrderId) {
  return request({
    url: '/repair/workOrder/startOrder',
    method: 'put',
    params:{
      workOrderId
    }
  })
}

//修改工单
export function workOrderUpdate(data) {
  return request({
    url: '/repair/workOrder/',
    method: 'put',
    data
  })
}

//拒绝工单
export function workOrderRefuse(data) {
  return request({
    url: '/repair/workOrder/refuse',
    method: 'put',
    data
  })
}

//转交
export function workOrderTransfer(data) {
  return request({
    url: '/repair/workOrder/transfer',
    method: 'put',
    data
  })
}

//接单
export function workOrderAccept(data) {
  return request({
    url: '/repair/workOrder/accept',
    method: 'put',
    data
  })
}

//挂起
export function workOrderHoldUp(data) {
  return request({
    url: '/repair/workOrder/holdUp',
    method: 'put',
    data
  })
}

//完成工单
export function workOrderFinish(data) {
  return request({
    url: '/repair/workOrder/finish',
    method: 'put',
    data
  })
}

//求助
export function workOrderNeedHelp(data) {
  return request({
    url: '/repair/workOrder/needHelp',
    method: 'put',
    data
  })
}

//转派工程师
export function assignEngineer(data) {
  return request({
    url: '/repair/workOrder/assignEngineer',
    method: 'post',
    data
  })
}

//批量转派工程师
export function assignEngineerBatch(data) {
  return request({
    url: '/repair/workOrder/assignEngineerBatch',
    method: 'post',
    data
  })
}


// 发起报修
export function startWorkOrder(data) {
  return request({
    url: '/repair/workOrder/start',
    method: 'post',
    data: data
  })
}

//报修工单
export function getRepairOrder(params) {
  return request({
    url: '/repair/workOrder/list',
    method: 'get',
    params
  })
}